<?php
/*
+------------------------------------------------------------------------------+
| Copyright (c) 2009, Draftrack Team                                           |
| All rights reserved.                                                         |
|                                                                              |
| Redistribution and use in source and binary forms, with or without           |
| modification, are permitted provided that the following conditions are met:  |
|     * Redistributions of source code must retain the above copyright         |
|       notice, this list of conditions and the following disclaimer.          |
|     * Redistributions in binary form must reproduce the above copyright      |
|       notice, this list of conditions and the following disclaimer in the    |
|       documentation and/or other materials provided with the distribution.   |
|     * Neither the name of the <organization> nor the                         |
|       names of its contributors may be used to endorse or promote products   |
|       derived from this software without specific prior written permission.  |
|                                                                              |
| THIS SOFTWARE IS PROVIDED BY draftrack team ''AS IS'' AND ANY                |
| EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED    |
| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE       |
| DISCLAIMED. IN NO EVENT SHALL draftrack team BE LIABLE FOR ANY               |
| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES   |
| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND  |
| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS|
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                 |
+------------------------------------------------------------------------------+
*/


error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
ini_set("display_errors", 1);
ini_set('display_startup_errors', 1);

//setting of the include_path to guarantee that libraries or correctly called
define('ROOT_PATH', realpath(dirname(__FILE__) . '/..'));
if(!defined('PATH_SEPARATOR')) {
	define('PATH_SEPARATOR', (eregi('win', PHP_OS) ? ';' : ':'));
}
// DT include folders MUST be included FIRST to avoid other
// possible not compatible libraries (i.e PEAR) to be included
// instead the ones provided by DT
$include_path = ROOT_PATH. '/app'. PATH_SEPARATOR;
$include_path.= ROOT_PATH . '/lib'. PATH_SEPARATOR;
$include_path.= ini_get('include_path');


if (set_include_path($include_path) === false) {
  die('Fatal error: set_include_path does not work. Please check the forum');
}

/* In PHP 5.3 if not set this triggers a notice */
date_default_timezone_set('Europe/Paris');


//We set up the autoloader for easyng call of other components
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();

/* We register our custom zend framework extension */
$autoloader->registerNamespace('Myzen_');



// We retrieve an instance of the front controller
$front = Zend_Controller_Front::getInstance();  

// We add our initialization plugins
$front->registerPlugin(new Myzen_Controller_Plugin_Config(), 10); 
$front->registerPlugin(new Myzen_Controller_Plugin_Log(), 13); 
$front->registerPlugin(new Myzen_Controller_Plugin_Session(), 15); 
$front->registerPlugin(new Myzen_Controller_Plugin_ValidateToken(), 30);
$front->registerPlugin(new Myzen_Controller_Plugin_Layout(), 50); 
$front->registerPlugin(new Myzen_Controller_Plugin_ModuleRoute(), 60); 

//All errors are processed using the error controller
$front->throwExceptions(true); 


$front->addModuleDirectory(ROOT_PATH . '/app/src/modules');
$front->setDefaultModule('index');




								   

//Now we can start the controller magic
$front->dispatch();


?>